Coto: language fix.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 28 Jul 2005 01:24:00 +0000 (01:24 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 28 Jul 2005 01:24:00 +0000 (01:24 +0000)
XMLGeneric: fix case when input buffer of cdata may be fragged.  Coalesce and return on the ending tag.

gpsbabel/coto.c
gpsbabel/xmlgeneric.c

index 139c7ad4a6ea36c839da3928dc9747a78ca217b4..a325d0ffbb09daa0c07bf8e153b10fde8a5c624d 100644 (file)
@@ -282,6 +282,7 @@ data_read(void)
 static void
 coto_prepare_wpt_write(struct pdb *opdb)
 {
+       struct appinfo *ai;
        opdb->name[PDB_DBNAMELEN-1] = 0;
        opdb->attributes = PDB_ATTR_BACKUP;
        opdb->type = MYTYPEWPT;  
@@ -293,7 +294,7 @@ coto_prepare_wpt_write(struct pdb *opdb)
        opdb->appinfo_len = APPINFO_PACKED_SIZE;
        opdb->appinfo = xcalloc(APPINFO_PACKED_SIZE,1);
        
-       struct appinfo *ai = (struct appinfo *) opdb->appinfo;
+       ai = (struct appinfo *) opdb->appinfo;
        
        ai->renamedCategories = 31; // Don't ask me why...
        if (zerocat)
index 9ba56770b830785245245dd22951d1e90529286e..f9877da1f0968b44796c231ca9c6d52d3bc6c7cf 100644 (file)
@@ -180,11 +180,6 @@ xml_cdata(void *dta, const XML_Char *s, int len)
        estr = (char *) cdatastr.mem + strlen(cdatastr.mem);
        memcpy(estr, s, len);
        estr[len]  = 0;
-
-       cb = xml_tbl_lookup(current_tag.mem, cb_cdata);
-       if (cb) {
-               (*cb)(estr, NULL);
-       }
 }
 
 static void
@@ -196,6 +191,10 @@ xml_end(void *data, const char *el)
        if (strcmp(s + 1, el)) {
                fprintf(stderr, "Mismatched tag %s\n", el);
        }
+       cb = xml_tbl_lookup(current_tag.mem, cb_cdata);
+       if (cb) {
+               (*cb)( (char *) cdatastr.mem, NULL);
+       }
 
        cb = xml_tbl_lookup(current_tag.mem, cb_end);
        if (cb) {